export default {
	requestData(store, ops) {
		let token = getApp() && getApp().globalData.token || store.state.globalData && store.state.globalData
			.token || null;
		return new Promise((resolve, reject) => {
			uni.request({
				url: store.state.apiDomain + ops.path,
				data: ops.data,
				header: {
					token: token || null,
					lang: store.state.globalData && store.state.globalData.lang || "zh-CN"
				},
				method: "POST",
				success(res) {
					try {
						if (res.data.status === 1) {
							resolve(res.data)
						} else if (res.data.status === 0) {
							reject({
								err: "",
								message: ""
							})
						}
					} catch (e) {
						reject(e)
					}
				},
				fail(err) {
					reject(err)
				}
			})
		})
	},
}